

import static org.junit.Assert.*;
import junit.framework.TestCase;

import org.junit.Test;

import android.cs2340UDT.Item;

public class checkInfoTest extends TestCase {

	@Test
	public void test() {
		
	//ensure completely valid entry works
		assertEquals(0, Item.checkInfo("Not Checked", "Not Checked", "01", "01", "1111", "Not Checked"));
		
	//ensure length testing section works
		
		//valid length entries
		assertEquals(0, Item.checkInfo("Not Checked", "Not Checked", "01", "01", "1111", "Not Checked"));
		
		//invalid month length - too long
		assertEquals(1, Item.checkInfo("Not Checked", "Not Checked", "011", "01", "1111", "Not Checked"));
		
		//invalid month length - too short
		assertEquals(1, Item.checkInfo("Not Checked", "Not Checked", "0", "01", "1111", "Not Checked"));
		
		//invalid day length - too long
		assertEquals(1, Item.checkInfo("Not Checked", "Not Checked", "01", "011", "1111", "Not Checked"));
		
		//invalid day length - too short
		assertEquals(1, Item.checkInfo("Not Checked", "Not Checked", "01", "0", "1111", "Not Checked"));
		
		//invalid year length - too long
		assertEquals(1, Item.checkInfo("Not Checked", "Not Checked", "01", "01", "11111", "Not Checked"));
		
		//invalid year length - too short
		assertEquals(1, Item.checkInfo("Not Checked", "Not Checked", "01", "01", "111", "Not Checked"));
		
	//ensure checking for non numeric characters works
		//non numeric in month
		assertEquals(1, Item.checkInfo("Not Checked", "Not Checked", "ab", "01", "1111", "Not Checked"));
		
		//non numeric in day
		assertEquals(1, Item.checkInfo("Not Checked", "Not Checked", "01", "ab", "1111", "Not Checked"));
		
		//non numeric in year
		assertEquals(1, Item.checkInfo("Not Checked", "Not Checked", "01", "01", "abab", "Not Checked"));
		
	//ensure checking of date and month range works
		
		//improper day range - too low
		assertEquals(1, Item.checkInfo("Not Checked", "Not Checked", "01", "00", "1111", "Not Checked"));
		
		//improper day range - too high
		assertEquals(1, Item.checkInfo("Not Checked", "Not Checked", "01", "32", "1111", "Not Checked"));
		
		//improper month range - too low
		assertEquals(1, Item.checkInfo("Not Checked", "Not Checked", "00", "01", "1111", "Not Checked"));
		
		//improper month range - too high
		assertEquals(1, Item.checkInfo("Not Checked", "Not Checked", "13", "01", "1111", "Not Checked"));
		
	}

}
